package com.badlogic.androidgames.mypirates;

import android.graphics.Point;

import com.badlogic.androidgames.framework.Input.TouchEvent;

public class MyGameHelper {
	public static Point ConvertToMapCordinate(TouchEvent event){
		int touchX = event.x;
		int touchY = event.y;
		if(touchX < Constants.InitialPositionX
				|| touchX > Constants.InitialPositionX + Constants.MapX * Constants.MapPieceWidth
				|| touchY < Constants.InitialPositionY
				|| touchY > Constants.InitialPositionY + Constants.MapY * Constants.MapPieceHeight){
			return new Point(-1,-1);
		}
		else{
			int x = (touchX - Constants.InitialPositionX) / Constants.MapPieceWidth;
			int y = (touchY - Constants.InitialPositionY) / Constants.MapPieceHeight;
			return new Point(x, y);
		}
	}
}
